package ru.sazonov.ide.model

class ModelPart {
    private List<Unit> units = [];
    private List<Artefact> artefacts = [];
    
    def void join(ModelPart part) {
        if (part) {
            units += part.units;
            artefacts += part.artefacts;
        }
    }

    def void add(Unit unit, List<Artefact> artefacts) {
        unit.artefacts.addAll(artefacts);
        artefacts.each {it.unit = unit};
        units.add(unit);
        artefacts.addAll(artefacts);
    }

    def List<Unit> getUnits() {units}
    def List<Artefact> getArtefacts() {artefacts}
}
